package com.example.rabbit.controller;


import com.example.rabbit.config.RabbitDeadLetterConfig;
import com.example.rabbit.service.Sender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:MuJiuTian
 * @Description:
 * @Date: Created in 下午10:23 2019/8/19
 */
@RestController
public class DeadLetterController {

    @Autowired
    private Sender sender;

    @RequestMapping(value = "/dead")
    public void send(){
        sender.send( RabbitDeadLetterConfig.DEAD_LETTER_EXCHANGE, RabbitDeadLetterConfig.DEAD_LETTER_TEST_ROUTING_KEY,"我是死信队列的生产者,业务处理将会报错");
    }

    @RequestMapping(value = "/deadDDL")
    public void send2(){
        sender.sendByDDL( RabbitDeadLetterConfig.DEAD_LETTER_EXCHANGE, RabbitDeadLetterConfig.DEAD_LETTER_TEST_ROUTING_KEY,"我是死信队列的生产者，业务处理将会超时ddl",5000);
    }
}
